<?php

/**
 * myContact form.
 *
 * @package    docplus.co.za
 * @subpackage form
 * @author     Fox Matuku
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class myContactForm extends ContactForm {

	public function configure() {
		unset(
			$this['created_at'], $this['updated_at']
		);

		$this->widgetSchema['user_id'] = new sfWidgetFormInputHidden();
		$this->widgetSchema['home_phone']->setAttributes(array("autocomplete" => "off"));
		$this->widgetSchema['work_phone']->setAttributes(array("autocomplete" => "off"));
		$this->widgetSchema['mobile_phone']->setAttributes(array("autocomplete" => "off"));
//		$this->widgetSchema['alternate_email']->setAttributes(array("autocomplete" => "off"));
		$this->widgetSchema['street_address'] = new sfWidgetFormInputText(array(), array("autocomplete" => "off"));
		$this->widgetSchema['post_code']->setAttributes(array("autocomplete" => "off"));
		$this->widgetSchema['area']->setAttributes(array("autocomplete" => "off"));
		$this->widgetSchema['city_id']->setOption("add_empty", "Please select a city")->setAttribute("class", "select-box-small");
		$this->widgetSchema['region_id']->setOption("add_empty", "Please select a region")->setAttribute("class", "select-box-small");

		$this->validatorSchema['home_phone'] = new gfPhoneNumberValidator(array("required" => false), array("invalid" => "Your *home phone* is invalid.", "required" => "Your *home phone* is required."));
		$this->validatorSchema['work_phone'] = new gfPhoneNumberValidator(array("required" => false), array("invalid" => "Your *work phone* is invalid.", "required" => "Your *work phone* is required."));
		$this->validatorSchema['mobile_phone'] = new gfPhoneNumberValidator(array("required" => true), array("invalid" => "Your *mobile phone* is invalid.", "required" => "Your *mobile phone* is required."));
		$this->validatorSchema['street_address'] = new sfValidatorString(array('max_length' => 255, 'required' => true), array('required' => 'Your *street address* is required.'));
		$this->validatorSchema['post_code'] = new sfValidatorString(array('max_length' => 255, 'required' => true), array('required' => 'Your *post code* is required.'));
		$this->validatorSchema['area'] = new sfValidatorString(array('max_length' => 255, 'required' => true), array('required' => 'Your *area* is required.'));
		$this->validatorSchema['city_id'] = new sfValidatorString(array('max_length' => 255, 'required' => true), array('required' => 'Your *city* is required.'));
		$this->validatorSchema['region_id'] = new sfValidatorString(array('max_length' => 255, 'required' => true), array('required' => 'Your *region* is required.'));
	}
}